# Copyright (c) 2014 Spotify AB

cmake_minimum_required(VERSION 2.8)
project(JniHelpersTestsData)

set(TESTS_DIR ${PROJECT_SOURCE_DIR}/..)
set(TEST_CONSTANTS_GENERATOR_COMMAND ${CMAKE_CURRENT_LIST_DIR}/../bin/generate_test_constants.sh)
set(TEST_CONSTANTS_CPP_FILE ${TESTS_DIR}/cpp/TestConstants.h)
set(TEST_CONSTANTS_JAVA_FILE ${TESTS_DIR}/java/com/spotify/jni/TestConstants.java)
set(TEST_CONSTANTS_DATA_FILE ${CMAKE_CURRENT_LIST_DIR}/TestConstants.txt)

add_custom_command(OUTPUT ${TEST_CONSTANTS_CPP_FILE} ${TEST_CONSTANTS_JAVA_FILE}
  DEPENDS ${TEST_CONSTANTS_DATA_FILE}
  COMMAND ${TEST_CONSTANTS_GENERATOR_COMMAND} ${TEST_CONSTANTS_DATA_FILE} ${TEST_CONSTANTS_CPP_FILE} ${TEST_CONSTANTS_JAVA_FILE}
  WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)

add_custom_target(JniHelpersTestsGenerateData ALL
  DEPENDS ${TEST_CONSTANTS_CPP_FILE}
  DEPENDS ${TEST_CONSTANTS_JAVA_FILE}
)
